Fedora 22
Sponsored Link

OpenStack Juno : Configure Keystone#2
2015/06/05
 
Add Users or Roles, Services and so on in Keystone.
[1] Load environment variables first.
Set value for "SERVICE_TOKEN" from the value "admin_token" in keystone.conf.
[root@dlp ~]#
export SERVICE_TOKEN=admintoken

[root@dlp ~]#
export SERVICE_ENDPOINT=http://10.0.0.30:35357/v2.0/

[2] Add Tenants ( like group ).
# add admin tenant

[root@dlp ~]#
keystone tenant-create --name admin --description "Admin Tenant" --enabled true

+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |           Admin Tenant           |
|   enabled   |               True               |
|      id     | a521391a3fff4634ab11a18d06772ded |
|     name    |              admin               |
+-------------+----------------------------------+

# add service tenant

[root@dlp ~]#
keystone tenant-create --name service --description "Service Tenant" --enabled true

+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |          Service Tenant          |
|   enabled   |               True               |
|      id     | 164aae3d5dd34992b62855fca07d8833 |
|     name    |             service              |
+-------------+----------------------------------+

# confirm settings

[root@dlp ~]#
keystone tenant-list

+----------------------------------+---------+---------+
|                id                |   name  | enabled |
+----------------------------------+---------+---------+
| a521391a3fff4634ab11a18d06772ded |  admin  |   True  |
| 164aae3d5dd34992b62855fca07d8833 | service |   True  |
+----------------------------------+---------+---------+
[3] Add Roles.
# add admin role

[root@dlp ~]#
keystone role-create --name admin

+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|    id    | 93e1f582793d48a8b996012a09557c6c |
|   name   |              admin               |
+----------+----------------------------------+

# add Member role

[root@dlp ~]#
keystone role-create --name Member

+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|    id    | eaf26a3c0fdc465f82efce9bb56da6a1 |
|   name   |              Member              |
+----------+----------------------------------+

# confirm settings

[root@dlp ~]#
keystone role-list

+----------------------------------+--------+
|                id                |  name  |
+----------------------------------+--------+
| eaf26a3c0fdc465f82efce9bb56da6a1 | Member |
| 93e1f582793d48a8b996012a09557c6c | admin  |
+----------------------------------+--------+
[4] Add Users.
# add admin user (set in admin tenant)

[root@dlp ~]#
keystone user-create --tenant admin --name admin --pass adminpassword --enabled true

+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|  email   |                                  |
| enabled  |               True               |
|    id    | 02144a8abeb54624b70b3d03be576ea7 |
|   name   |              admin               |
| tenantId | a521391a3fff4634ab11a18d06772ded |
| username |              admin               |
+----------+----------------------------------+

# add admin user in admin role

[root@dlp ~]#
keystone user-role-add --user admin --tenant admin --role admin
# add glance user (set in service tenant)

[root@dlp ~]#
keystone user-create --tenant service --name glance --pass servicepassword --enabled true

+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|  email   |                                  |
| enabled  |               True               |
|    id    | 255a9b2f213642c49c914873324c5185 |
|   name   |              glance              |
| tenantId | 164aae3d5dd34992b62855fca07d8833 |
| username |              glance              |
+----------+----------------------------------+

# add glance user in admin role

[root@dlp ~]#
keystone user-role-add --user glance --tenant service --role admin
# add nova user (set in service tenant)

[root@dlp ~]#
keystone user-create --tenant service --name nova --pass servicepassword --enabled true

+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|  email   |                                  |
| enabled  |               True               |
|    id    | 3cae2a58c0144424a697a04b4ee01fd2 |
|   name   |               nova               |
| tenantId | 164aae3d5dd34992b62855fca07d8833 |
| username |               nova               |
+----------+----------------------------------+

# add nova user in admin role

[root@dlp ~]#
keystone user-role-add --user nova --tenant service --role admin
# confirm settings

[root@dlp ~]#
keystone user-list

+----------------------------------+--------+---------+-------+
|                id                |  name  | enabled | email |
+----------------------------------+--------+---------+-------+
| 02144a8abeb54624b70b3d03be576ea7 | admin  |   True  |       |
| 255a9b2f213642c49c914873324c5185 | glance |   True  |       |
| 3cae2a58c0144424a697a04b4ee01fd2 |  nova  |   True  |       |
+----------------------------------+--------+---------+-------+
[5] Add entries for services.
# add for keystone

[root@dlp ~]#
keystone service-create --name=keystone --type=identity --description="Keystone Identity Service"

+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |    Keystone Identity Service     |
|   enabled   |               True               |
|      id     | 5f8aefb97c144631997feb33fece661d |
|     name    |             keystone             |
|     type    |             identity             |
+-------------+----------------------------------+

# add for glance

[root@dlp ~]#
keystone service-create --name=glance --type=image --description="Glance Image Service"

+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |       Glance Image Service       |
|   enabled   |               True               |
|      id     | 88fdac02a8d547ce9efb0405730558b3 |
|     name    |              glance              |
|     type    |              image               |
+-------------+----------------------------------+

# add for nova

[root@dlp ~]#
keystone service-create --name=nova --type=compute --description="Nova Compute Service"

+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |       Nova Compute Service       |
|   enabled   |               True               |
|      id     | 6861754fadee4dc8831e5895bba684c6 |
|     name    |               nova               |
|     type    |             compute              |
+-------------+----------------------------------+

# confirm settings

[root@dlp ~]#
keystone service-list

+----------------------------------+----------+----------+---------------------------+
|                id                |   name   |   type   |        description        |
+----------------------------------+----------+----------+---------------------------+
| 88fdac02a8d547ce9efb0405730558b3 |  glance  |  image   |    Glance Image Service   |
| 5f8aefb97c144631997feb33fece661d | keystone | identity | Keystone Identity Service |
| 6861754fadee4dc8831e5895bba684c6 |   nova   | compute  |    Nova Compute Service   |
+----------------------------------+----------+----------+---------------------------+
[6] Add Endpoints.
# define my host

[root@dlp ~]#
export my_host=10.0.0.30
# add endpoint for keystone

[root@dlp ~]#
keystone endpoint-create --region RegionOne \
--service keystone \
--publicurl "http://$my_host:\$(public_port)s/v2.0" \
--internalurl "http://$my_host:\$(public_port)s/v2.0" \
--adminurl "http://$my_host:\$(admin_port)s/v2.0"

+-------------+---------------------------------------+
|   Property  |                 Value                 |
+-------------+---------------------------------------+
|   adminurl  |  http://10.0.0.30:$(admin_port)s/v2.0 |
|      id     |    8ecee34531f643cd91cd2b44552d9945   |
| internalurl | http://10.0.0.30:$(public_port)s/v2.0 |
|  publicurl  | http://10.0.0.30:$(public_port)s/v2.0 |
|    region   |               RegionOne               |
|  service_id |    5f8aefb97c144631997feb33fece661d   |
+-------------+---------------------------------------+

# add endpoint for glance

[root@dlp ~]#
keystone endpoint-create --region RegionOne \
--service glance \
--publicurl "http://$my_host:9292/v1" \
--internalurl "http://$my_host:9292/v1" \
--adminurl "http://$my_host:9292/v1"

+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
|   adminurl  |     http://10.0.0.30:9292/v1     |
|      id     | fe7342140cf04950b6a9601781fae129 |
| internalurl |     http://10.0.0.30:9292/v1     |
|  publicurl  |     http://10.0.0.30:9292/v1     |
|    region   |            RegionOne             |
|  service_id | 88fdac02a8d547ce9efb0405730558b3 |
+-------------+----------------------------------+

# add endpoint for nova

[root@dlp ~]#
keystone endpoint-create --region RegionOne \
--service nova \
--publicurl "http://$my_host:\$(compute_port)s/v2/\$(tenant_id)s" \
--internalurl "http://$my_host:\$(compute_port)s/v2/\$(tenant_id)s" \
--adminurl "http://$my_host:\$(compute_port)s/v2/\$(tenant_id)s"

+-------------+----------------------------------------------------+
|   Property  |                       Value                        |
+-------------+----------------------------------------------------+
|   adminurl  | http://10.0.0.30:$(compute_port)s/v2/$(tenant_id)s |
|      id     |          6001769bb0b04a998e6bf8d6950f6588          |
| internalurl | http://10.0.0.30:$(compute_port)s/v2/$(tenant_id)s |
|  publicurl  | http://10.0.0.30:$(compute_port)s/v2/$(tenant_id)s |
|    region   |                     RegionOne                      |
|  service_id |          6861754fadee4dc8831e5895bba684c6          |
+-------------+----------------------------------------------------+

# confirm settings

[root@dlp ~]#
keystone endpoint-list

+----------------------------------+-----------+----------------------------------------------------+
|                id                |   region  |                     publicurl                      |
+----------------------------------+-----------+----------------------------------------------------+
| 6001769bb0b04a998e6bf8d6950f6588 | RegionOne | http://10.0.0.30:$(compute_port)s/v2/$(tenant_id)s |
| 8ecee34531f643cd91cd2b44552d9945 | RegionOne |       http://10.0.0.30:$(public_port)s/v2.0        |
| fe7342140cf04950b6a9601781fae129 | RegionOne |              http://10.0.0.30:9292/v1              |
+----------------------------------+-----------+----------------------------------------------------+
+----------------------------------------------------+
|                    internalurl                     |
+----------------------------------------------------+
| http://10.0.0.30:$(compute_port)s/v2/$(tenant_id)s |
|       http://10.0.0.30:$(public_port)s/v2.0        |
|              http://10.0.0.30:9292/v1              |
+----------------------------------------------------+
+----------------------------------------------------+----------------------------------+
|                      adminurl                      |            service_id            |
+----------------------------------------------------+----------------------------------+
| http://10.0.0.30:$(compute_port)s/v2/$(tenant_id)s | 6861754fadee4dc8831e5895bba684c6 |
|        http://10.0.0.30:$(admin_port)s/v2.0        | 5f8aefb97c144631997feb33fece661d |
|              http://10.0.0.30:9292/v1              | 88fdac02a8d547ce9efb0405730558b3 |
+----------------------------------------------------+----------------------------------+
 
Tweet